import React, { PureComponent } from 'react'
import ThemeContext from '../context/theme_context'
import withTheme from '../hoc/with_theme';


// export class Home extends PureComponent {
//   render() {
//     return (
//       <ThemeContext.Consumer>
//         {
//           value => {
//             return <h2>Home: color - {value.color}</h2>
//           }
//         }
//       </ThemeContext.Consumer>
//     )
//   }
// }

export class Home extends PureComponent {
  render() {
    console.log(this.props); // 通过调用高阶组件withTheme 把context通过props传给调用者
    return (
      <h2>Home: color - {this.props.color}</h2>
    )
  }
}
export default withTheme(Home)